<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>

import axios from 'axios'
import jsonp from 'jsonp'

export default {
  name: 'App',
  components: {
  },
   data(){
     return{
       data:''
     }
   },
  mounted(){
    this.getAxios();
    this.getjsonp();
    this.getother();
  },
  methods:{
      getAxios(){
        let url = 'https://www.easy-mock.com/mock/5c2237b04e21841210a7013c/example/mock'
        axios.get(url).then(() => {
          console.log("11111")
        })
      },
      getjsonp(){
        let url = 'https://www.imooc.com/activity/servicetime'
        jsonp(url,()=>{
          console.log("22222")
        })
      },
      //代理跨域
      getother(){
        let url = "/api/activity/servicetime";
        // jsonp(url,(err,res) => {
        //   let result = res;
        //   this.data = result;
        // })
        axios.post(url).then(response => {
          console.log(response);
        })
        .catch(error => {
          console.log(error);
        })
        .then(() => {
          // always executed
        })
        console.log("11111")
      }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
